If an output MIDI file is not specified, then output is sent to stdout If an input sequence file is not specified then input is read from stdin
The purpose of is to generate more complicated MIDI files from smaller MIDI file components.
The BNF or quasi- BNF as I don't quite remember the true form, looks like this:
The results look like this (though this isn't a very practical example):
track # This is track 1 pat1.mid pat2.mid A: { pat3.mid B: { # block B: pat4.mid pat5.mid } pat6.mid repeat B: 3 } pat7.mid pat8.mid # pattern 8 # This is track 2 track pat1.mid pat2.mid A: { pat3.mid pat4.mid B: pat5.mid pat6.mid repeat B: 6 } pat7.mid repeat A:
There are six main parts to a sequence file. There are tracks blocks repeats comments and files The tracks are different sections of the sequence that should play in parallel and should belong to separate tracks in the output MIDI file. Each track will start at time 0, the beginning of the sequence. Every sequence must have at least one track. Tracks are designated by the word track This is a simple example of using tracks,
track part1.mid part2.mid part3.mid track partA.mid partB.mid partC.mid
In this case two tracks will be created and, assuming all the parts are the same length, part1.mid will be played the same time partA.mid is played, part2.mid will be played the same time partB.mid is played, etc.
Blocks are groups of one or more files or other blocks. Each block has a label, which is designated by ending in a So : Sc . If a block is to consist of only on file, then it may be labeled directly like,
ShortBlock: part1.mid
Otherwise the block should be enclosed in curly braces like,
LongerBlock: { part1.mid part2.mid part3.mid }
Blocks may even contain other blocks like,
OutterBlock: { part1.mid InnerBlock: { part2.mid part3.mid } part4.mid }
In this case InnerBlock: contains part2.mid and part3.mid while OutterBlock: contains part1.mid , part2.mid , part3.mid part4.mid
Repeats provide a way of re-sequencing previously defined blocks. Repeats consist of the string repeat followed by a block name, including the colon, and an optional number. The optional number specifies the number of times the block should be repeated. If no number is specified, the block is only repeated once. A simple example of a repeat looks like,
ABlock: part1.mid repeat ABlock: 3
The sequence generated by this fragment would contain, part1.mid , part1.mid , part1.mid and part1.mid A more complicated example might look like,
Block1: { part1.mid part2.mid Block2: { part3.mid part4.mid } repeat Block2: 2 } part5.mid repeat Block1:
This sequence generates, part1.mid , part2.mid , part3.mid part4.mid , part3.mid , part4.mid part3.mid , part4.mid , part5.mid part1.mid , part2.mid , part3.mid part4.mid , part3.mid , part4.mid part3.mid and part4.mid
Comments begin with a `#' and continue to the end of a line. completely ignores anything in a comment. This is an example of a few comments,
track # This track is for the drum part backbeat: pat1.mid repeat pat1.mid 7 pat2.mid # here's a turn around fill
The final part of a sequence file is the most important. It is the filenames of the smaller MIDI files that are to be sequenced. Each filename specifies one MIDI file and is read into the sequence as they are encountered in the sequence file. They are also read in when blocks containing them are repeated. Currently, only MIDI files of format 1 are accepted.
Though there is not much complexity in the sequencing language, it should be rich enough to allow the easy creation of sophisticated MIDI files.
The remaining tracks in the output MIDI file will correspond to the tracks in the sequence file. These tracks are created by collapsing each smaller MIDI file listed in the sequence file to just two tracks, track 0 which remains unchanged, and track 1 which is created by merging all the other tracks in the file. These collapsed files are then concatenated together to form one long MIDI file for each track. As mentioned above, the track 0's from each sequence track are then merged to form one new track 0 while the other tracks are kept separate in the final output.
The resulting MIDI file can then be manipulated just like any other MIDI file.